In [1]:
%matplotlib inline
In [2]:
import numpy as np
import matplotlib.pyplot as plt
import qcodes as qc
import qcodes.instrument.parameter as parameter
import qcodes.instrument_drivers.AlazarTech.ATS9360 as ATSdriver
from qdev_wrappers.alazar_controllers.ATSChannelController import ATSChannelController
from qdev_wrappers.alazar_controllers.alazar_channel import AlazarChannel
#import qcodes.instrument_drivers.AlazarTech.acq_helpers as helpers
from qcodes.station import Station
import logging
logging.basicConfig(level=logging.INFO)
In [3]:
from qcodes.instrument.parameter import ManualParameter
import qcodes
NB: See ATS9360 example notebook for general commands
In [4]:
# Create the ATS9360 instrument
alazar = ATSdriver.AlazarTech_ATS9360(name='Alazar')
# Print all information about this Alazar card
alazar.get_idn()
Out[4]:
In [5]:
# Configure all settings in the Alazar card
alazar.config(clock_source='INTERNAL_CLOCK',
sample_rate=1_000_000_000,
clock_edge='CLOCK_EDGE_RISING',
decimation=1,
coupling=['DC','DC'],
channel_range=[.4,.4],
impedance=[50,50],
trigger_operation='TRIG_ENGINE_OP_J',
trigger_engine1='TRIG_ENGINE_J',
trigger_source1='EXTERNAL',
trigger_slope1='TRIG_SLOPE_POSITIVE',
trigger_level1=160,
trigger_engine2='TRIG_ENGINE_K',
trigger_source2='DISABLE',
trigger_slope2='TRIG_SLOPE_POSITIVE',
trigger_level2=128,
external_trigger_coupling='DC',
external_trigger_range='ETR_2V5',
trigger_delay=0,
timeout_ticks=0,
aux_io_mode='AUX_IN_AUXILIARY', # AUX_IN_TRIGGER_ENABLE for seq mode on
aux_io_param='NONE' # TRIG_SLOPE_POSITIVE for seq mode on
)
In [7]:
# Create the acquisition controller which will take care of the data handling and tell it which
# alazar instrument to talk to. Explicitly pass the default options to the Alazar.
# Dont integrate over samples but avarage over records
myctrl = ATSChannelController(name='my_controller', alazar_name='Alazar')
Put the Alazar and the controller in a station so we ensure that all parameters are captured
In [8]:
station = qc.Station(alazar, myctrl)
This controller is designed to be highlevel and it is not possible to directly set number of records, buffers and samples. The number of samples is indirecly controlled by the integration time and integration delay and the number of averages controls the number of buffers and records acquired
In [9]:
myctrl.int_time.set?
In [10]:
myctrl.int_time._latest
Out[10]:
In [11]:
myctrl.int_delay(2e-7)
myctrl.int_time(2e-6)
print(myctrl.samples_per_record())
#myctrl.num_avg(1000)
Per default the controller does not have any channels assiated with it.
In [12]:
myctrl.channels
Out[12]:
Lets define a channel were we avarege over buffers and records but not over samples. This will give us a time series with a x axis defined by int_time, int_delay and the sampling rate. First we create a channel and set the relevant parameters. We may choose to append the channel to the controllers build in list of channels for future reference.
In [13]:
chan1 = AlazarChannel(myctrl, 'mychan', demod=False, integrate_samples=False)
myctrl.channels.append(chan1)
In [14]:
chan1.num_averages(1000)
chan1.alazar_channel('A')
chan1.prepare_channel()
# Measure this
data1 = qc.Measure(chan1.data).run()
qc.MatPlot(data1.my_controller_mychan_data)
Out[14]:
We can measure the time taken to do a measurement
In [15]:
%%time
qc.Measure(chan1.data).run()
Out[15]:
We may optionally chose to demodulate the data that we acquire using a software demodulator
In [16]:
chan1d = AlazarChannel(myctrl, 'mychan_demod_1', demod=True, integrate_samples=False)
myctrl.channels.append(chan1d)
In [17]:
chan1d.num_averages(1000)
chan1d.alazar_channel('A')
chan1d.demod_freq(1e6)
chan1d.demod_type('magnitude')
chan1d.prepare_channel()
# Measure this
data1d = qc.Measure(chan1d.data).run()
qc.MatPlot(data1d.my_controller_mychan_demod_1_data)
Out[17]:
We are free to add more demodulators with different frequencies
In [18]:
chan1d2 = AlazarChannel(myctrl, 'mychan_demod_2', demod=True, integrate_samples=False)
myctrl.channels.append(chan1d2)
In [19]:
chan1d2.num_averages(1000)
chan1d2.alazar_channel('A')
chan1d2.demod_freq(2e6)
chan1d2.demod_type('magnitude')
chan1d2.prepare_channel()
# Measure this
data1d = qc.Measure(chan1d2.data).run()
qc.MatPlot(data1d.my_controller_mychan_demod_2_data)
Out[19]:
In [20]:
myctrl.channels
Out[20]:
We can get the data from multiple chanels in one provided that the shape (buffers,records,samples) is the same, The time overhead is fairly small as we are only capturing the data once.
In [21]:
%%time
data = qc.Measure(myctrl.channels.data).run()
In [22]:
data1 = qc.Measure(myctrl.channels.data).run()
plot = qc.MatPlot()
plot.add(data.my_controller_mychan_data)
plot.add(data.my_controller_mychan_demod_1_data)
plot.add(data.my_controller_mychan_demod_2_data)
We can also do a 1D trace of records
In [23]:
chan2 = AlazarChannel(myctrl, 'myrecchan', demod=False, average_records=False)
myctrl.channels.append(chan2)
In [24]:
chan2.num_averages(100)
chan2.records_per_buffer(55)
chan2.alazar_channel('A')
chan2.prepare_channel()
# Measure this
data2 = qc.Measure(myctrl.channels[-1].data).run()
qc.MatPlot(data2.my_controller_myrecchan_data)
Out[24]:
Again it is posssible to demodulate the data
In [25]:
chan2d = AlazarChannel(myctrl, 'myrecchan_D', demod=True, average_records=False)
myctrl.channels.append(chan2d)
In [26]:
print(myctrl.int_delay())
print(myctrl.int_time())
In [27]:
myctrl.int_time._latest
Out[27]:
In [28]:
chan2d.alazar_channel('A')
chan2d.demod_freq(1e6)
chan2d.demod_type('magnitude')
In [29]:
chan2d.num_averages(100)
chan2d.records_per_buffer(55)
chan2d.alazar_channel('A')
chan2d.prepare_channel()
# Measure this
data2d = qc.Measure(myctrl.channels[-1].data).run()
qc.MatPlot(data2d.my_controller_myrecchan_D_data)
Out[29]:
In [30]:
myctrl.channels
Out[30]:
In [31]:
myctrl.channels[-2:]
Out[31]:
In [32]:
data = qc.Measure(myctrl.channels[-2:].data).run()
plot = qc.MatPlot()
plot.add(data.my_controller_myrecchan_data )
plot.add(data.my_controller_myrecchan_D_data)
We can also do a 1D trace over buffers in the same way
In [33]:
chan3 = AlazarChannel(myctrl, 'myrecchan', demod=False, average_buffers=False)
myctrl.channels.append(chan3)
In [34]:
chan3.num_averages(100)
chan3.buffers_per_acquisition(100)
chan3.alazar_channel('A')
alazar.buffer_timeout._set(10000)
alazar.buffer_timeout._set_updated()
chan3.prepare_channel()
# Measure this
data3 = qc.Measure(chan3.data).run()
qc.MatPlot(data3.my_controller_myrecchan_data)
print(alazar.buffer_timeout())
And demodulate this
In [35]:
chan3d = AlazarChannel(myctrl, 'myrecchan_d', demod=True, average_buffers=False)
myctrl.channels.append(chan3d)
In [36]:
chan3d.num_averages(100)
chan3d.buffers_per_acquisition(100)
chan3d.alazar_channel('A')
chan3d.demod_freq(2e6)
chan3d.demod_type('magnitude')
alazar.buffer_timeout._set(10000)
alazar.buffer_timeout._set_updated()
chan3d.prepare_channel()
# Measure this
data3 = qc.Measure(chan3d.data).run()
qc.MatPlot(data3.my_controller_myrecchan_d_data)
print(alazar.buffer_timeout())
In [37]:
data = qc.Measure(myctrl.channels[-2:].data).run()
plot = qc.MatPlot()
plot.add(data.my_controller_myrecchan_data)
plot.add(data.my_controller_myrecchan_d_data)
In [38]:
chan4 = AlazarChannel(myctrl, 'myrecvssamples', demod=False, average_records=False, integrate_samples=False)
myctrl.channels.append(chan4)
In [39]:
chan4.num_averages(1)
chan4.records_per_buffer(100)
chan4.alazar_channel('A')
chan4.prepare_channel()
# Measure this
data4 = qc.Measure(chan4.data).run()
qc.MatPlot(data4.my_controller_myrecvssamples_data)
Out[39]:
In [40]:
chan5 = AlazarChannel(myctrl, 'mybuffersvsrecs', demod=False, average_records=False, average_buffers=False)
alazar.buffer_timeout._set(10000)
chan5.records_per_buffer(72)
chan5.buffers_per_acquisition(10)
chan5.num_averages(1)
chan5.alazar_channel('A')
chan5.prepare_channel()
# Measure this
data5 = qc.Measure(chan5.data).run()
qc.MatPlot(data5.my_controller_mybuffersvsrecs_data)
print(alazar.buffer_timeout())
In [41]:
chan6 = AlazarChannel(myctrl, 'mybufvssamples', demod=False, average_buffers=False, integrate_samples=False)
chan6.buffers_per_acquisition(100)
chan6.num_averages(100)
chan6.alazar_channel('A')
chan6.prepare_channel()
# Measure this
data6 = qc.Measure(chan6.data).run()
plot = qc.MatPlot(data6.my_controller_mybufvssamples_data)
In [42]:
chan7 = AlazarChannel(myctrl, 'mybufvssamples', demod=False)
chan7.num_averages(100)
chan7.alazar_channel('A')
chan7.prepare_channel()
# Measure this
data7 = qc.Measure(chan7.data).run()
As we are not integrating over samples the setpoints (label, unit and ticks on number) are automatically set from the integration time and integration delay. Note at the moment this does not cut of the int_delay from the plot. It probably should
In [43]:
chan1 = AlazarChannel(myctrl, 'mychan1', demod=False, integrate_samples=False)
chan1.num_averages(1000)
chan1.alazar_channel('A')
chan1.prepare_channel()
chan2 = AlazarChannel(myctrl, 'mychan2', demod=False, integrate_samples=False)
chan2.num_averages(1000)
chan2.alazar_channel('B')
chan2.prepare_channel()
myctrl.channels.append(chan1)
myctrl.channels.append(chan2)
#plot = qc.MatPlot(data6.my_controller_mybufvssamples_data)
In [44]:
data7 = qc.Measure(myctrl.channels[-2:].data).run()
plot = qc.MatPlot(data7.my_controller_mychan1_data, data7.my_controller_mychan2_data)
In [ ]:
In [ ]: